package easydst;

import java.net.MalformedURLException;
import java.rmi.Naming;
import java.rmi.RemoteException;

import util.Msg;

public class TestAgentServer {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		
		TestAgent agent;
		Result results;
		try {
			Msg.log("Initializing the test agent.");
			agent = new TestAgentImpl();
			results = new ResultImpl();			
			Naming.rebind("rmi://localhost:1099/" + Constants.AGENT_NAME, agent);
			Msg.log("The test agent was initialized.");
			
			//for test
			String completeCommand = "";
			for (String arg : args) {
				completeCommand += arg +" " ;
			}			
			Msg.debug(completeCommand);
			
			
			Msg.log("Initializing the result collector.");
			Naming.rebind("rmi://localhost:1099/" + Constants.RESULT_NAME, results); //TODO verificar se mais de um serviço pode ficar na mesma porta!
			Msg.log("The result collector was initialized.");
		} catch (RemoteException e) {
//			Msg.error(e.getMessage());
			e.printStackTrace();
		} catch (MalformedURLException e) {
//			Msg.error(e.getMessage());
			e.printStackTrace();
		}

	}
	
}
